package com.gitonway.fineday.activity;


import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.Toast;

import com.gitonway.fineday.utils.DialogUtils;

public class BaseActivity extends Activity{
	protected Dialog progressDialog = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		super.onCreate(savedInstanceState);
	}
	public void showLongToast(String pMsg)
	{
		Toast.makeText(this, pMsg, Toast.LENGTH_LONG).show();
	}
	public void showShortToast(String pMsg) {
	    Toast.makeText(this, pMsg, Toast.LENGTH_SHORT).show();
	}
	public void openActivity(Class<?> pClass)
	{
		openActivity(pClass,null);
	}
	public void showProgressDialog(){
		if(progressDialog == null){
			DialogUtils dialog = DialogUtils.Instance();
			progressDialog = dialog.createLoadingDialog(this);
		}
		if(!progressDialog.isShowing())
			progressDialog.show();
	}
	public void dismissProgressDialog()
	{
		if(progressDialog!=null)
		{
			progressDialog.dismiss();
		}
	}
	public void openActivity(Class<?> pClass,Bundle pBundle){
		Intent intent = new Intent(this,pClass);
		if(pBundle != null)
		{
			intent.putExtras(pBundle);
		}
		startActivity(intent);
	}
}
